<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    request.setCharacterEncoding("UTF-8");
    String htmlData = request.getParameter("content1") != null ? request.getParameter("content1") : "";
%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <script type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=path%>/CSS/backLayout.css">
</head>
<style>
    .div_input {
        width: 500px;
        height: 40px;
    }
</style>
<body style="background: #f5f5f5">
<div class="main">
    <div class="weizhi">
        基础资料>>人力基础资料>>薪酬项目>>新增
    </div>
    <div class="div_body" style="box-shadow: 0 0 5px #cccccc;">
        <div class="div_form">
            <form action="<%=path%>/DrivingSys/addRemuneration.html" class="form"  onsubmit=" return subForm()">
                <div class="fwrz">
                    <div class="div_input">
                        <span class="gn_name">驾校&nbsp;:&nbsp;</span>
                        <input type="text" readonly="readonly" name="fcontrolunitid" value="${department_remuneration.fnameL2}" style="color: gray;">
                    </div>
                    <div class="div_input">
                        <span class="gn_name">编码&nbsp;:&nbsp;</span>
                        <input type="text" name="fnumber"  value="${fnumber}" style="color: gray;">
                    </div>
                    <div class="div_input">
                        <span class="gn_name">名称&nbsp;:&nbsp;</span>
                        <input type="text" class="fnameL2" name="fnameL2" style="color: gray;">&nbsp;<span><font color="red">必填</font></span>
                    </div>
                    <div class="div_input">
                        <span class="gn_name">简称&nbsp;:&nbsp;</span>
                        <input type="text" name="fsimplename">
                    </div>
                    <div class="div_input_hang">
                    <div class="input_hang">
                     <span class="gn_name">状态&nbsp;:&nbsp;</span>
                    	<select name="cfstate" style="width: 234px;height: 31px" id="cfstateId">
                    	<option value="1">启动</option>
                    	<option value="2">禁用</option>
                    </select>
                    </div>
                    </div>
                     <div class="div_input_hang">
                    <div class="input_hang">
                     <span class="gn_name">类型&nbsp;:&nbsp;</span>
                    	<select name="cffixation" style="width: 234px;height: 31px" id="cffixationId">
                    	<option value="1">固定</option>
                    	<option value="2">可变</option>
                    	<option value="3">手录</option>
                    	<option value="4">内置</option>
                    </select>
                    </div>
                    </div>
                    <div class="div_input">
                        <span class="gn_name">金额&nbsp;:&nbsp;</span>
                        <input type="text" name="cfamount" class="cfamount"  placeholder="请输入数字">
                                        <span style="font-size: 14px;color: red;display: none" class="haoyou">请输入数字</span>
                    </div>
                    <div class="div_input">
                        <span class="gn_name">描述&nbsp;:&nbsp;</span>
                        <input type="text" name="fdescriptionL2" id="gs">
                    </div>
                    <div class="div_tj" style="margin-left: 140px">
                        <div>
                            <input type="submit" class="input_submit bc" value="" style="margin-right: 30px;"/>
                        </div>
                        <div>
                            <input type="button" class="input_back fh" value="" onclick="back()"/>
                        </div>
                    </div>
            </form>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="<%=path%>/JQuery/jquery-1.8.2.js"></script>
<%@ include file="/WEB-INF/JSP/ajax.jsp" %>
<script type="text/javascript">
    $(document).ready(function () {
        var type = "${type}";
        if (type == "1") {
            //alert("添加成功!");
            editAlert();
        }
    })
    function back(){
        location="<%=path%>/DrivingSys/selectRemuneration.html/look.action";
    }
    //键盘事件
    $(".cfamount").live('keyup', function(event) {
        //最后一位是小数点的话，移除
        var $amountInput = $(this);
        //响应鼠标事件，允许左右方向键移动
        event = window.event || event;
        if(event.keyCode == 37 | event.keyCode == 39) {
            return;
        }
        //先把非数字的都替换掉，除了数字和.
        $amountInput.val($amountInput.val().replace(/[^\-?\d.]/g, "").
        //只允许一个小数点
        replace(/^\./g, "").replace(/\.{2,}/g, ".").
        //只能输入小数点后两位
        replace(".", "$#$").replace(/\./g, "").replace("$#$", ".").replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'));
    });
    function subForm() {
        var fnameL2 = $(".fnameL2").val();
        if(fnameL2 == null || fnameL2 == ''){
            alert("必填项不能为空!")
            return false;
        }
    }
</script>
</html>